#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "pms5005.h"
#include "packet.h"

#define LEN 40

int main(int argc, char *argv[])
{
	packet_t *p = NULL;
	uint8_t data[LEN];
	uint8_t stream[MAX_PACKET_LEN];
	int i = 0;

	srand(time(0));

	while (1) {
		for ( i = 0; i<LEN; i++) {
			//data[i] = ((double)(rand()/RAND_MAX) * 255);
			data[i] = rand() % 256;
		}
		packet_new(&p, RID_HOST, 0, SENSOR_FB, LEN, data);
		packet_serialize(p, stream);
		fwrite(stream, 1, packet_stream_length(stream), stdout);
		packet_delete(p);
	}

	return 0;
}
